DSA Homework 3

Roger Jang


Due date: 20190430 23:59:59

Best strategy in a poker game

Problem definition

Alice and Bob are playing a simple poker game with the following rules:

When the game ends, the loser still has some cards at hand, and the total points of these cards indicate how much the loser needs to pay the winner. (A card's points are defined by its number, as explain below.)

During the game, the winner wants to maximize the points of the loser's remaining cards, while the loser want to minimize it. Your mission is to design a stragegy for both players to play optimally, and find out who is the winner and the remaining points of the loser.

A card can be denoted by its suit and number:

Therefore a card can be represented by a two-character string, such as "DT" (diamond 10) or "SA" (spade A), etc.

Note that a card's points are denoted by its number, such that A==>1, 2==>2, 3==>3, ..., 9==>9, T==>10, J==>11, Q==>12, K==>13.

I/O formats

Open Test Sets

Hints and Suggestions